/***************************************************
> Copyright (C) 2024 ==KINGYI== All rights reserved.
> File Name: 8.5se.c
> Author:
> Mail: 
> Created Time: Mon 05 Aug 2024 01:18:07 AM PDT
***************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc,const char* argv[])
{
	int fd = 0;
	char buf[100] = {0};
	int ret = 0;

	fd = open("./project/text",O_WRONLY|O_CREAT);
	if(fd == -1)
	{
		perror("open");
	}
	printf("please input a string:\n");
	scanf("%s",buf);
  while(1)
	{
		ret = write(fd,buf,strlen(buf));
		if(ret == -1)
		{
			perror("write");
			exit(-1);
		}
	}
	close(fd);
	return 0;
}
